/**
 * 
 */
package com.base.myproject.client.busi.b2c;

import com.base.myproject.client.busi.b2c.shopping.ShoppingCarPanel;
import com.base.myproject.client.busi.b2c.shopping.ShoppingOrder;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * 用户信息
 * @author zgw
 *2009-8-18 上午11:06:04
 * javazgw@gmail.com
 */
public class UserInfoPanel extends ContentPanel{
	
	String ccode = "";
	public UserInfoPanel(String ccode)
	{
		this.ccode = ccode;
		init();
		
	}
	protected void init()
	{
		this.setBorders(true);
		
		this.setHeading("你的信息");
		
		this.add(CreatePanel());
		addStyleName("basepanelmargin");
		
	}
	
	Widget CreatePanel()
	{
		VerticalPanel vpanel = new VerticalPanel();
		String str = "<div><ul>";
		
		str += "<li><a href=\"javascript:void(0)\"  onclick=\"javascript:_show_user_shoping_cart("+ccode+")\" class=\"shopli\"><img src=\"../images/baseimage/shoppingcar.gif\">查看购物车 </a></li>";
		str +="<li><a href=\"javascript:void(0)\"  onclick=\"javascript:_show_user_shoping_listorder("+ccode+")\" class=\"shopli\"><img src=\"../images/baseimage/shoppingorder.gif\">查看订单 </a></li>";
		str +="<li><a href=\"javascript:void(0)\"  onclick=\"javascript:_show_edit_myinfo("+ccode+")\" class=\"shopli\"><img src=\"../images/baseimage/page_user_dark.gif\">我的资料 </a></li>";
		str +="</ul></div>";
		Html html = new Html(str);
		vpanel.add(html);
		return vpanel;
	}
	/**
	 * 
	 * 显示订单
	 * @param ccode
	 */
	public static void ShowShoppingOrder(String ccode)
	{
		ShoppingOrder scp = new ShoppingOrder(ccode);
		MainPage.getCenterpanel().removeAll();
		MainPage.getCenterpanel().add(scp);
		MainPage.getCenterpanel().layout();
	}
/**
 * 显示购物车
 * @param ccode
 */
	public static void ShowShoppingCart(String ccode)
	{
		ShoppingCarPanel scp1 = new ShoppingCarPanel(ccode);
		MainPage.getCenterpanel().removeAll();
		MainPage.getCenterpanel().add(scp1);
		MainPage.getCenterpanel().layout();
	}
	/**
	 * 显示能编辑的用户信息
	 * @param ccode
	 */
	public static void ShowEditMyinfo(String ccode)
	{
		CcodePanel cp = new CcodePanel(ccode,true);
		MainPage.getCenterpanel().removeAll();
		MainPage.getCenterpanel().add(cp);
		MainPage.getCenterpanel().layout();
	}
	/**
	 * 显示用户资料
	 * @param ccode
	 */
	public static void ShowMyinfo(String ccode)
	{
		CcodePanel cp = new CcodePanel(ccode);
		MainPage.getCenterpanel().removeAll();
		MainPage.getCenterpanel().add(cp);
		MainPage.getCenterpanel().layout();
	}
}
